﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;




    public partial class additongame :  System.Web.UI.Page 
    {
      
        Kidclass kid = new Kidclass();
       Game1class game1 = new Game1class();

        public string identity;
        public static int result = 0;
        public static int counter;
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBox1.Visible = false;
            TextBox3.Visible = false;
            TextBox4.Visible = false;
            Button.Visible = false;
            OK.Visible = false;

        }

        protected void Button_Click(object sender, EventArgs e)
        {
            TextBox1.Visible = true;
            TextBox3.Visible = true;
            TextBox4.Visible = true;
            Button.Visible = true;
            OK.Visible = true;
        

            counter++;
           // Response.Write(counter);
            if (counter == 5)
            {
               // Response.Write(counter);
                Button.Visible = false;

            }
            else
            {
                kid.play_game(game1);
                //Response.Write("hello");
               
                TextBox1.Text =game1.tex1 ;
                TextBox3.Text = game1.tex2;
            }
        }
        protected void OK_Click(object sender, EventArgs e)
        {
            TextBox1.Visible = true;
            TextBox3.Visible = true;
            TextBox4.Visible = true;
            Button.Visible = true;
            OK.Visible = true;
        

             // int answer;
            int temp;

            game1.Select_ResultGame();
           temp = game1.tempgame;
            if (TextBox4.Text ==Convert.ToString(temp))
            {
                Response.Write("right");
                
                Response.Write("PLZ click to get another question");
            }
            else
            {
                Response.Write("false");
                result++;
                Response.Write("PLZ click to get another question");
               
            }
          
           // answer = 5 - result;
           
         //  game1.Update_game(answer);
         
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
        //    Response.Write("your grade is");
        //    game1.Return_Grade();
           
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            Response.Redirect("Profilepage.aspx");
        }
        protected void Button4_Click(object sender, EventArgs e)
        {
            TextBox1.Visible = true;
            TextBox3.Visible = true;
            TextBox4.Visible = true;
            Button.Visible = true;
            OK.Visible = true;
        }
}   
        
    
